from .base import Base
from .common import CommonMixin
from sqlalchemy import String, Integer, Column
from sqlalchemy.orm import relationship

""" 用户所属组织 """


class Group(Base, CommonMixin):
    __tablename__ = 'group'

    dept_id = Column(Integer, primary_key=True, comment='部门id', autoincrement=True)
    parent_id = Column(Integer, default=0, comment='父部门id')
    ancestors = Column(String(50), default='', comment='所有父级的id')
    dept_name = Column(String(32), unique=True, comment="部门名称")
    order_num = Column(Integer, default=0, comment='显示顺序')
    leader = Column(String(20),  comment='负责人',nullable=True)
    phone = Column(String(20), comment='联系电话', nullable=True)
    email = Column(String(50), comment='邮箱', nullable=True)
    update_by = Column(String(64), comment='更新者', nullable=True)
    create_by = Column(String(64), comment='创建者', nullable=True)
    del_flag = Column(String(1), default='0', comment='删除标志（0代表存在 2代表删除）')
